import random
import time

import schedule

"""
每隔十分钟执行一次任务
每隔一小时执行一次任务
每天的10:30执行一次任务
每隔5到10天执行一次任务 
每周一的这个时候执行一次任务
每周三13:15执行一次任务
run_pending：运行所有可以运行的任务
"""


def job_test():
    print("her name is : ", 'name')


time_list_select = ['01:33:33', '09:30:20', '07:33:30', '08:20:21', '06:33:32', '09:33:21', '08:16:33', '08:13:56']
time_hour = ['08', '09']
time_min = []


def schedule_call_select():
    name = "longsongpong"

    # schedule.every(2).second.do(job, name)  # seconds 每秒执行参数可以不是1  second every()的参数必须是1
    #
    # schedule.every().hour.do(job, name)
    # schedule.every().day.at("10:30").do(job, name)
    # schedule.every(5).to(10).days.do(job, name)
    # schedule.every().monday.do(job, name)
    # schedule.every().monday.at('13:15').do(job, name)
    # schedule.every().tuesday.at("18:32:20").do(job_test)
    schedule.every().wednesday.at(random.choice(['10:08:50'])).do(job_test)
    # schedule.every().wednesday.at("13:15").do(job, name)
    # schedule.every().wednesday.at("13:15").do(job, name)

    # schedule.every(2).seconds.do(job, name)

    while True:
        schedule.run_pending()
        time.sleep(1)


def job2():
    print("I'm working... in job2")


def schedule_call_select_2():
    schedule.every(10).seconds.do(job2)
    schedule.every(10).seconds.do(job2)

    while True:
        schedule.run_pending()
        time.sleep(1)


if __name__ == '__main__':
    schedule_call_select()
    # 随机取值
    # print(random.choice(time_list_select))
    # str_time = str(random.choice(['08', '09']) + ':' + str(random.randint(10, 59)) + ':' + str(random.randint(10, 59)))
    #
    # print(str_time)
    # print(type(str_time))
    # print(random.choice(['10:08:50']))
